package top.kaoshanji.ch04;

import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import top.kaoshanji.ch04.statics.Employee;

/**
 * 代码清单 ch04-03：静态版本的Employee
 * @see top.kaoshanji.ch04.statics.Employee
 * author kaoshanji
 * ^_^
 * create time 2024/11/25 10:22
 */
public class StaticTest {

    private static final Logger logger = LogManager.getLogger(StaticTest.class);

    public static void main(String[] args) {
        logger.info("...代码清单 ch04-03：静态版本的Employee...");

        var staff = new Employee[3];

        staff[0] = new Employee("Tom", 40000);
        staff[1] = new Employee("Dick", 60000);
        staff[2] = new Employee("Harry", 65000);

        for (Employee e: staff) {
            e.setId();

            System.out.println("name=" + e.getName() + ",id=" + e.getId() + ",salary=" + e.getSalary());
        }

        int n = Employee.getNextId(); // calls static method
        System.out.println("Next available id=" + n);

    }

}
